package com.heima.behavior.controller.v1;

import com.heima.behavior.service.*;
import com.heima.model.behavior.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1")
public class BehaviorController {
    @Resource
    ApArticleBehaviorService articleBehaviorService;
    @Resource
    ApCollectionBehaviorService collectionBehaviorService;
    @Resource
    ApLikesBehaviorService likesBehaviorService;
    @Resource
    ApReadBehaviorService readBehaviorService;
    @Resource
    ApUnlikeBehaviorService unlikeBehaviorService;

    @PostMapping("/likes_behavior")
    public ResponseResult like(@RequestBody LikesBehaviorDTO dto){
        return likesBehaviorService.like(dto);
    }
    @PostMapping("/read_behavior")
    public ResponseResult read(@RequestBody ReadBehaviorDTO dto){
        return readBehaviorService.readBehavior(dto);
    }
    @PostMapping("/un_likes_behavior")
    public ResponseResult unlike(@RequestBody UnLikesBehaviorDTO dto){
        return unlikeBehaviorService.unlikeBehavior(dto);
    }
    @PostMapping("/collection_behavior")
    public ResponseResult coll(@RequestBody CollectionBehaviorDTO dto){
        return collectionBehaviorService.collectBehavior(dto);
    }
    @PostMapping("/article/load_article_behavior")
    public ResponseResult like(@RequestBody ArticleBehaviorDTO dto){
        return articleBehaviorService.loadArticleBehavior(dto);
    }

}
